/*
package com.songaw.cangku.controller;

import java.util.concurrent.atomic.AtomicInteger;

import javax.validation.Valid;

import com.songaw.cangku.base.util.MessageUtil;
import com.songaw.cangku.common.util.EhcacheUtil;
import com.songaw.cangku.pojo.Result;
import com.songaw.cangku.pojo.entity.AppAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class RestAppLoginController {
    
  //  @Autowired
   // private AuthServer authServer;
 
   
   
    
    @RequestMapping(value = "/rest/app/login")
    public Result<AppAccount> appLogin(@RequestParam String username, @RequestParam String password) {


        //retrycount + 1
        Object element = EhcacheUtil.getItem(username);
        if (element == null) {
            EhcacheUtil.putItem(username, 1);
            element=0;
        }else{
            int count=Integer.parseInt(element.toString())+1;
            element=count;
            EhcacheUtil.putItem(username,element);
        }
        AtomicInteger retryCount = new AtomicInteger(Integer.parseInt(element.toString()));
        if (retryCount.incrementAndGet() > 5) {
            return Result.getParamsErrorResult(MessageUtil.getMessage("error.0005"));

        }else{
        try {
        	AppAccount login = new AppAccount();//authServer.appLogin(request.getDetail());

        	if(login == null){
                return    Result.getParamsErrorResult(MessageUtil.getMessage("error.0002"));


        	}else{

        		 EhcacheUtil.removeItem(username);
        		 return Result.getSuccessResult(login);
        	}
		} catch (Exception e) {
            return    Result.getParamsErrorResult(e.getMessage());
			//modelMap.addAttribute(Result.getSystemErrorResult(e.getMessage()));
		}
        }
	}
    
   
    

    
    @RequestMapping(value = "/rest/app/logout.json", method = RequestMethod.POST)
	public String appLogin(ModelMap modelMap) {
    	

        return null;
	}
    



	


}
*/
